package service.auth.impl;

import java.util.HashMap;
import java.util.List;

import model.auth.Authorities;
import model.auth.AuthoritiesResources;
import model.auth.Resources;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import core.base.page.Page;
import core.base.page.PageRequest;

import service.auth.AuthoritiesResourcesService;
import dao.auth.AuthoritiesResourcesDao;

@Service("auth.AuthoritiesResourcesService")
public class AuthoritiesResourcesServiceImpl implements AuthoritiesResourcesService {

	@Autowired
	@Qualifier("auth.AuthoritiesResourcesDao")
	private AuthoritiesResourcesDao authoritiesResourcesDao;

	public int deleteById(Long id) {
		return authoritiesResourcesDao.deleteById(id);
	}

	public AuthoritiesResources getById(Long id) {
		return authoritiesResourcesDao.getById(id);
	}

	public void insert(AuthoritiesResources model) {
		authoritiesResourcesDao.insert(model);
	}

	public List<Authorities> getAuthoritiesByResId(Long resid) {		
		return authoritiesResourcesDao.getAuthoritiesByResId(resid);
	}

	public List<Resources> getResourcesByAuthId(Long authid) {
		return authoritiesResourcesDao.getResourcesByAuthId(authid);
	}

	public Page<Resources> queryAuthoritiesForPage(PageRequest<HashMap> pageReq) {
		return authoritiesResourcesDao.queryAuthoritiesForPage(pageReq);
	}

	public Page<Authorities> queryResourcesForPage(PageRequest<HashMap> pageReq) {
		return authoritiesResourcesDao.queryResourcesForPage(pageReq);
	}

	public void setAuthoritiesResourcesDao(AuthoritiesResourcesDao authoritiesResourcesDao) {
		this.authoritiesResourcesDao = authoritiesResourcesDao;
	}

}
